import pprint
import os

import ecs

a = ecs.AmazonECS(AccessKeyID = os.environ['AWS_ECS_ACCESSKEYID'])

def present(a, generator, max = 20):
	count = 0
	for d in generator:
		count += 1
		pprint.pprint(d, width = 1)

		if count >= max:
			break

	if count == 0:
		print "no results", a.uri

if False:
	present(a, a.iterMusicByArtist('U2'))

if True:
	present(a, a.iterMusicByKeywords('U2 The Joshua Tree', ResponseGroup = [ a.RG_Large, ]))

if False:
	present(a, a.iterBooksByKeywords("Niven Pournelle mote", ResponseGroup = [ a.RG_Large, a.RG_OfferSummary, ], Sort = "relevancerank"), max = 4)

if False:
	present(a, a.iterBooksByAuthor('Larry Niven', ResponseGroup = [ a.RG_Large ]))
